package pkg.commands;

import pkg.Player;
import pkg.networking.NetworkedPlayer;

@SuppressWarnings("serial")
public abstract class PlayerCmd extends BaseCommand<NetworkedPlayer> 
{
	protected int playerID;
	
	public int getPlayerID()
	{
		return playerID;
	}
	
	public final void execute()
	{
		data.mode(NetworkedPlayer.LOCALMODE);
		executeLocal();
		data.mode(NetworkedPlayer.REMOTEMODE);
	}
	
	protected void executeLocal()
	{
		
	}
	
	public void setPlayerID(int playerID)
	{
		this.playerID = playerID;
	}
	
	public static PlayerMoveCmd move(int id,Player.Direction dir,int speed)
	{
		PlayerMoveCmd cmd = new PlayerMoveCmd(dir,speed);
		cmd.setPlayerID(id);
		return cmd;
	}
	
	public static PlayerCmdSyncPos synchPosition(int id,java.awt.Point pt)
	{
		return new PlayerCmdSyncPos(id,pt);
	}
	
}